package com.itheima.thread.blockingqueue.demo02;

import java.util.concurrent.ArrayBlockingQueue;

public class CustomerThread implements Runnable {

    private ArrayBlockingQueue<Box> arrayBlockingQueue;
    public CustomerThread(ArrayBlockingQueue<Box> arrayBlockingQueue) {
        this.arrayBlockingQueue = arrayBlockingQueue;
    }

    @Override
    public void run() {

        while (true) {
            try {
                Box box = arrayBlockingQueue.take();
                System.out.println(box.getMilkType() + "----" + box.getAmount());
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

    }
}
